<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // function Person(name) {
      //   console.log('hello ' + name);
      // }
      // 类 class 函数的语法糖
      class Person {
        constructor(name) {
          // this = {}
          // this.__proto__=Person.prototype
          this.age = 20;
          console.log('hello ' + name);
          // return this;
        }
        say() {
          console.log('hello');
        }
      }
      // Person.prototype.say = function () {
      //   console.log('hello');
      // };
      const p = new Person('jack');
      console.log(p);
    </script>
  </body>
</html>
